home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _splitpl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.7 KB  |  67 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__splitpl = "$Header: C:\CURSES\private\RCS\_splitpl.c 2.1 1993/06/18 20:23:52 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10. #ifdef    FLEXOS
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_flexos_split_plane()    - splits a char/attr plane into separate planes
  14.  
  15.   PDCurses Description:
  16.      This is a private PDCurses function.
  17.  
  18.      This routine is used only be the Flexos platform.
  19.  
  20.      This routine will separate the character/attributes plane into
  21.      a separate character and attribute plane.
  22.  
  23.   PDCurses Return Value:
  24.      This function returns OK upon success otherwise ERR is returned.
  25.  
  26.   PDCurses Errors:
  27.      It is an error to pass a NULL WINDOW pointer.
  28.      It is also an error if the starting x or y coordinate exceeds the
  29.      passed window boundaries.
  30.  
  31.   Portability:
  32.      PDCurses    int    PDC_flexos_split_plane( WINDOW* w,
  33.                      char* chr, char* attr,
  34.                      int sy, int sx,
  35.                      int ey, int ex );
  36.  
  37. **man-end**********************************************************************/
  38.  
  39. int    PDC_flexos_split_plane(WINDOW* w,char* chr,char* attr,int sy,int sx,int ey,int ex)
  40. {
  41.     int    l;
  42.     int    c;
  43.  
  44. #ifdef PDCDEBUG
  45.     if (trace_on) PDC_debug("PDC_flexos_split_plane() - called\n");
  46. #endif
  47.  
  48.     if (w == (WINDOW *)NULL)        return( ERR );
  49.     if (sy > w->_maxy)    return( ERR );
  50.     if (sx > w->_maxx)    return( ERR );
  51.     if (ey > w->_maxy)    ey = w->_maxy - 1;
  52.     if (ex > w->_maxx)    ex = w->_maxx - 1;
  53.  
  54.     for (l = sy; l <= ey; l++)
  55.     {
  56.         for (c = sx; c <= ex; c++)
  57.         {
  58.             *chr  = (char)(w->_y[l][c] & CHR_MSK);
  59.             *attr = (char)(w->_y[l][c] & ATR_MSK) >> 8;
  60.             chr++;
  61.             attr++;
  62.         }
  63.     }
  64.     return( OK );
  65. }
  66. #endif
  67.